package com.vken.blog.dao.hibernate;

import java.util.List;

import com.vken.blog.dao.UserDao;
import com.vken.blog.model.User;

public class UserDaoHibernate extends GenericDaoHibernate<User, Integer> implements UserDao {

	public User get(String username, String password) {
		List users = getHibernateTemplate().find(
				"from User as u where u.username=? and u.password=?",
				new Object[] { username, password });

		if (users.size() > 0) {
			return (User) users.get(0);
		} else {
			return null;
		}
	}
}
